/* 
 *  LEGAL STUFF
 * 
 *  This file is part of the GIPF Conversion.
 *  
 *  The  GIPF Conversion is Copyright 2010 Melissa Bollen
 *  
 *  GIPF and other content here copyright their respective copyright holders.
 *  
 *  The GIPF Conversion is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *   
 *  The GIPF Conversion  is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with The GIPF Conversion.  If not, see <http://www.gnu.org/licenses/>.
 */

package gipfProject.games.zertz;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JMenuBar;

import gipfProject.games.zertz.data.ZertzData;
import gipfProject.games.zertz.engine.ZertzEngine;
import gipfProject.games.zertz.gui.ZertzUI;

public class ZertzLauncher {
	static JFrame window;

	public static void launch() {
		// Create the game data
		ZertzData gameState = new ZertzData();

		// Create the game engine
		ZertzEngine engine = new ZertzEngine(gameState);

		// Create a new window with the title
		window = new JFrame("Zertz - The GIPF Project");

		// Create the GUI
		ZertzUI gui = new ZertzUI(window, gameState, engine);

		// Load the GUI into this window
		window.setContentPane(gui);

		// Resize the window to match the contents
		window.pack();

		// Makes the window open in the middle of the screen
		Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
		window.setLocation((screensize.width - window.getWidth()) / 2,
				(screensize.height - window.getHeight()) / 2);

		// Set the program to terminate if this window is closed
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Disable resizing the window
		window.setResizable(false);

		// Make the window visible
		window.setVisible(true);
	}// End main

}
